<!DOCTYPE html>
<html>

<head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <style>
        .container {
            background-color: red;
            position: relative;
            width: 100%;
            padding-top: 100%;
            /* 1:1 Aspect Ratio */
        }

        .text {
            position: absolute;
            top: 0;
            left: 0;
            bottom: 0;
            right: 0;
            text-align: center;
            font-size: 20px;
            color: white;
        }
    </style>
</head>

<body>


    <pre>
    <h2>

    缩放 宽高比
    缩放 宽高比:
    
    16:9       Aspect Ratio (divide 9 by 16 = 0.5625)     
    padding-top: 56.25%; 

    4:3       Aspect Ratio (divide 3 by 4 = 0.75)
    padding-top: 75%; 

    3:2       Aspect Ratio (divide 2 by 3 = 0.6666)
    padding-top: 66.66%; 

    8:5       Aspect Ratio (divide 5 by 8 = 0.625)
    padding-top: 62.5%;


    </h2>
    </pre>

    <h2>Maintain Aspect Ratio 1:1</h2>
    <p>Resize the window to see the effect.</p>

    <div class="container">
        <div class="text">1:1 Aspect ratio</div>
    </div>

    <p style="height: 1000px;"></p>

</body>

</html>